﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class ArrayExtensions
{
    public static float GetVector3(Vector3[] arr, int index, out float y, out float z)
    {
        var v = arr[index];
        y = v.y;
        z = v.z;
        return v.x;
    }

    public static void SetVector3(Vector3[] arr, int index, float x, float y, float z)
    {
        arr[index] = new Vector3(x, y, z);
    }

    public static float GetVector3(List<Vector3> list, int index, out float y, out float z)
    {
        var v = list[index];
        y = v.y;
        z = v.z;
        return v.x;
    }

    public static void SetVector3(List<Vector3> list, int index, float x, float y, float z)
    {
        list[index] = new Vector3(x, y, z);
    }


    public static float GetBoundingSpehere(BoundingSphere[] arr, int index, out float py, out float pz, out float radius)
    {
        var v = arr[index];
        py = v.position.y;
        pz = v.position.z;
        radius = v.radius;
        return v.position.x;
    }

    public static void SetBoundingSphere(BoundingSphere[] arr, int index, float px, float py, float pz, float radius)
    {
        arr[index].position = new Vector3(px, py, pz);
        arr[index].radius = radius;
    }

    public static float GetBoundingSpehere(List<BoundingSphere> arr, int index, out float py, out float pz, out float radius)
    {
        var v = arr[index];
        py = v.position.y;
        pz = v.position.z;
        radius = v.radius;
        return v.position.x;
    }

    public static void SetBoundingSphere(List<BoundingSphere> arr, int index, float px, float py, float pz, float radius)
    {
        BoundingSphere sphere = arr[index];
        sphere.position = new Vector3(px, py, pz);
        sphere.radius = radius;
        arr[index] = sphere;
    }
}
